platform :ios, '10.0'

workspace 'DTKMapBundle.xcworkspace'

target 'DTKMapBundle' do

    project 'DTKMapBundle/DTKMapBundle.xcodeproj'

    pod 'DTKExternalModule',  :path=>'~/.ddev/dep/DTKExternalModule'
    # 扩展点API
    pod 'DTKOpenAPIs',  :path=>'~/.ddev/dep/DTKOpenAPIs'
    # 基础库依赖包
    pod 'DTKBaseLibs', :path=>'~/.ddev/dep/DTKBaseLibs'
    # 高德SDK依赖包
    pod 'DTKAMapLibs', :path=>'~/.ddev/dep/DTKAMapLibs/D'
end

target 'DingTalkApp' do
    project 'DingTalkApp/DingTalkApp.xcodeproj'
end

=begin NOTE: 

[1]  DTKBaseLibs依赖包:

    AFNetworking
    AMPopTip
    Bolts
    CocoaHTTPServer
    CocoaLumberjack
    CPDataDrivenLayout
    DACircularProgress
    DateTools
    FCFileManager
    FDFullscreenPopGesture
    FileMD5Hash
    FLAnimatedImage
    FMDB
    FSCalendar
    FXBlurView
    HCSStarRatingView
    HexColors
    HyUIActionEvent
    JSONKit
    JSONModel
    KSPhotoBrowser
    KVOController
    leveldb-iOS
    libwebp
    Masonry
    MBProgressHUD
    MJRefresh
    ObjcAssociatedObjectHelpers
    Objective-LevelDB
    OpenSSL
    pop
    PromiseKit
    PureLayout
    Reachability
    RegexKitLite
    Repeat
    RxCocoa
    RxRelay
    RxSwift
    SDWebImage
    Shimmer
    SnapKit
    SwiftyJSON
    SWTableViewCell
    TOCropViewController
    TZImagePickerController
    UIActionKit
    YYKeyboardManager
    YYKit
    ZipArchive

[2]  DTKAMapLibs依赖包:

    AMapFoundation
    AMapSearch
    AMapLocation
    MAMapKit

=end

post_install do |installer|
    installer.aggregate_targets.each do |target|
        target.xcconfigs.each do |config_name, config_file|

            # 这些库不需要参与link，因为在ipa中都有了
            removing_frameworks = Dir::entries(File.expand_path('~/.ddev/dep/DTKOpenAPIs'))
            removing_frameworks = removing_frameworks.find_all { |item| item.end_with?('.framework') }
            removing_frameworks = removing_frameworks.map { |item| item.sub('.framework', '') }
            removing_frameworks = removing_frameworks + ['DTKExternalModule']
            config_file.frameworks.subtract(Array(removing_frameworks).to_set)

            xcconfig_path = target.xcconfig_path(config_name)
            config_file.save_as(xcconfig_path)
            puts "modify xcconfig file #{xcconfig_path}"
        end
    end
end

#if !File::exists?(File.expand_path("~/.ddev/dep/DTKBaseLibs/DTKBaseLibs.podspec"))
#  puts "\n❌当前未拉取基础依赖包!，请在终端执行 'ddev download-dependencies' 后重新pod install\n".red
#end

